package com.ecommerce.dal.common;

import java.util.List;

import com.ecommerce.dal.entity.Category;
import com.ecommerce.dal.service.impl.CategoryManagerService;

public class TestCategory {

	public TestCategory(CategoryManagerService categoryManagerService ) {
		Category category = new Category();
		category.setCategoryName("Under Wear");
		Category categoryTest = categoryManagerService.retrieveCategory("Cloths");
		
		category.setCategory(categoryTest);
////		Photo photo = new Photo();
////		Set<Photo> photos = new HashSet<Photo>();
//		
//		/**inserting*/
		categoryManagerService.saveCategory(category);
//		
		/**selection*/
		Category category2 = categoryManagerService.retrieveCategory(1L);
		System.out.println(category2.getCategoryName());
		
		
		category2 = categoryManagerService.retrieveCategory("Cloths");
		System.out.print("----------Subcategories----------\n\n");
		System.out.println("Category Id: "+category2.getCategoryId() + " ,  Category Name: "+category2.getCategoryName() );
		
		List<Category> subCategoryList2 = categoryManagerService.retrieveAllSubCategories(1L);
		for(Category categoryX : subCategoryList2){
			
			System.out.println("Category Id: "+categoryX.getCategoryId() + " ,  Category Name: "+categoryX.getCategoryName() );
		}
		System.out.print("----------\n|\n|\n|\n----------");
		List<Category> allCategories = categoryManagerService.retrieveAllCategories();
		for(Category categoryX : allCategories){
			
			System.out.println("Category Id: "+categoryX.getCategoryId() + " ,  Category Name: "+categoryX.getCategoryName() );
		}
		System.out.print("----------\n|\n|\n|\n----------");
		
		System.out.print("Done!");
		
	}

}
